
package com.ycy.smartcourseselection.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
 // extends WebMvcConfigurerAdapter
public class CorsConfig{

    static final String[] ORIGINS = new String[]{"GET", "POST", "PUT", "DELETE"};


    // @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOriginPatterns("*")
                .allowCredentials(true)
                .allowedMethods(ORIGINS)
                .maxAge(3600)
                .allowedHeaders("*");
    }
}